-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V3.8.2 physics debug draw #16208
Closed
Closed
V3.8.2 physics debug draw #16208
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -2468,19 +2468,33 @@
*
* @zh
* 描边效果组件,用于字体描边,只能用于系统字体。
*
- * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
+ * @example
+ * ```ts
+ * import { Node, Label, LabelOutline } from 'cc';
+ * // Create a new node and add label components.
+ * const node = new Node("New Label");
+ * const label = node.addComponent(Label);
+ * const outline = node.addComponent(LabelOutline);
+ * node.parent = this.node;
+ * ```
*/
export class LabelOutline extends Component {
+ protected _color: math.Color;
+ protected _width: number;
/**
* @en
* Outline color.
*
* @zh
* 改变描边的颜色。
*
- * @deprecated since v3.8.2, please use [[Label.outlineColor]] instead.
+ * @example
+ * ```ts
+ * import { Color } from 'cc';
+ * outline.color = new Color(0.5, 0.3, 0.7, 1.0);
+ * ```
*/
get color(): Readonly<math.Color>;
set color(value: Readonly<math.Color>);
/**
@@ -2489,20 +2503,18 @@
*
* @zh
* 改变描边的宽度。
*
- * @deprecated since v3.8.2, please use [[Label.outlineWidth]] instead.
+ * @example
+ * ```ts
+ * outline.width = 3;
+ * ```
*/
get width(): number;
set width(value: number);
- /**
- * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
- */
onEnable(): void;
- /**
- * @deprecated since v3.8.2, please use [[Label.enableOutline]] instead.
- */
onDisable(): void;
+ protected _updateRenderData(): void;
}
/**
* @en
* Graphics component.
@@ -2857,20 +2869,32 @@
}
/**
* @en Shadow effect for Label component, only for system fonts or TTF fonts.
* @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。
- *
- * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
+ * @example
+ * import { Node, Label, LabelShadow } from 'cc';
+ * // Create a new node and add label components.
+ * const node = new Node("New Label");
+ * const label = node.addComponent(Label);
+ * const shadow = node.addComponent(LabelShadow);
+ * node.parent = this.node;
*/
export class LabelShadow extends Component {
+ protected _color: math.Color;
+ protected _offset: math.Vec2;
+ protected _blur: number;
/**
* @en
* Shadow color.
*
* @zh
* 阴影的颜色。
*
- * @deprecated since v3.8.2, please use [[Label.shadowColor]] instead.
+ * @example
+ * ```ts
+ * import { Color } from 'cc';
+ * labelShadow.color = new Color(0.5, 0.3, 0.7, 1.0);
+ * ```
*/
get color(): Readonly<math.Color>;
set color(value: Readonly<math.Color>);
/**
@@ -2879,9 +2903,13 @@
*
* @zh
* 字体与阴影的偏移。
*
- * @deprecated since v3.8.2, please use [[Label.shadowOffset]] instead.
+ * @example
+ * ```ts
+ * import { Vec2 } from 'cc';
+ * labelShadow.offset = new Vec2(2, 2);
+ * ```
*/
get offset(): math.Vec2;
set offset(value: math.Vec2);
/**
@@ -2890,20 +2918,18 @@
*
* @zh
* 阴影的模糊程度。
*
- * @deprecated since v3.8.2, please use [[Label.shadowBlur]] instead.
+ * @example
+ * ```ts
+ * labelShadow.blur = 2;
+ * ```
*/
get blur(): number;
set blur(value: number);
- /**
- * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
- */
onEnable(): void;
- /**
- * @deprecated since v3.8.2, please use [[Label.enableShadow]] instead.
- */
onDisable(): void;
+ protected _updateRenderData(): void;
}
/**
* @en
* Set the UI transparency component.
@@ -3224,68 +3250,8 @@
*/
get underlineHeight(): number;
set underlineHeight(value: number);
/**
- ** @en
- ** Outline effect used to change the display, only for system fonts or TTF fonts.
- **
- ** @zh
- ** 描边效果组件,用于字体描边,只能用于系统字体或 ttf 字体。
- **/
- get enableOutline(): boolean;
- set enableOutline(value: boolean);
- /**
- * @en
- * Outline color.
- *
- * @zh
- * 改变描边的颜色。
- */
- get outlineColor(): math.Color;
- set outlineColor(value: math.Color);
- /**
- * @en
- * Change the outline width.
- *
- * @zh
- * 改变描边的宽度。
- */
- get outlineWidth(): number;
- set outlineWidth(value: number);
- /**
- * @en Shadow effect for Label component, only for system fonts or TTF fonts. Disabled when cache mode is char.
- * @zh 用于给 Label 组件添加阴影效果,只能用于系统字体或 ttf 字体。在缓存模式为 char 时不可用。
- */
- get enableShadow(): boolean;
- set enableShadow(value: boolean);
- /**
- * @en
- * Shadow color.
- *
- * @zh
- * 阴影的颜色。
- */
- get shadowColor(): math.Color;
- set shadowColor(value: math.Color);
- /**
- * @en
- * Offset between font and shadow.
- *
- * @zh
- * 字体与阴影的偏移。
- */
- get shadowOffset(): math.Vec2;
- set shadowOffset(value: math.Vec2);
- /**
- * @en
- * A non-negative float specifying the level of shadow blur.
- *
- * @zh
- * 阴影的模糊程度。
- */
- get shadowBlur(): number;
- set shadowBlur(value: number);
- /**
* @deprecated since v3.7.0, this is an engine private interface that will be removed in the future.
*/
get spriteFrame(): SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
/**
@@ -3321,15 +3287,8 @@
protected _isBold: boolean;
protected _isUnderline: boolean;
protected _underlineHeight: number;
protected _cacheMode: CacheMode;
- protected _enableOutline: boolean;
- protected _outlineColor: math.Color;
- protected _outlineWidth: number;
- protected _enableShadow: boolean;
- protected _shadowColor: math.Color;
- protected _shadowOffset: math.Vec2;
- protected _shadowBlur: number;
protected _N$file: Font | null;
protected _texture: SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
protected _ttfSpriteFrame: SpriteFrame | null;
protected _userDefinedFont: Font | null;
@@ -11395,8 +11354,9 @@
protected _passes: Pass[] | null;
protected _shaders: gfx.Shader[] | null;
protected _subMesh: RenderingSubMesh | null;
protected _patches: IMacroPatch[] | null;
+ protected _globalPatches: MacroRecord | null;
protected _priority: pipeline.RenderPriority;
protected _inputAssembler: gfx.InputAssembler | null;
protected _descriptorSet: gfx.DescriptorSet | null;
protected _worldBoundDescriptorSet: gfx.DescriptorSet | null;
@@ -26082,19 +26042,13 @@
* @zh 节点 layer 改变时触发的事件。
*/
LAYER_CHANGED = "layer-changed",
/**
- * @en This event indicates that the order of child nodes has been changed.
- * @zh 该事件表示子节点的排序发生了改变。
- * @deprecated since v3.8.2 @en Please use `CHILDREN_ORDER_CHANGED`. @zh 请使用 `CHILDREN_ORDER_CHANGED`。
+ * @en The event type for node's sibling order changed.
+ * @zh 当节点在兄弟节点中的顺序发生变化时触发的事件。
*/
SIBLING_ORDER_CHANGED = "sibling-order-changed",
/**
- * @en This event indicates that the order of child nodes has been changed.
- * @zh 该事件表示子节点的排序发生了改变。
- */
- CHILDREN_ORDER_CHANGED = "sibling-order-changed",
- /**
* @en
* Note: This event is only emitted from the top most node whose active value did changed,
* not including its child nodes.
* @zh
@@ -32339,9 +32293,9 @@
/**
* @en The event type for node's sibling order changed.
* @zh 当节点在兄弟节点中的顺序发生变化时触发的事件。
*
- * @deprecated since v3.3, please use Node.EventType.CHILDREN_ORDER_CHANGED instead
+ * @deprecated since v3.3, please use Node.EventType.SIBLING_ORDER_CHANGED instead
*/
SIBLING_ORDER_CHANGED = "sibling-order-changed"
}
/**
@@ -33695,13 +33649,8 @@
* @param x - x position
* @param y - y position
*/
setPrevPoint(x: number, y: number): void;
- /**
- * @zh Touch 对象的原始数据不应该被修改。如果你需要这么做,最好克隆一个新的对象。
- * @en The original Touch object shouldn't be modified. If you need to, it's better to clone a new one.
- */
- clone(): Touch;
}
/**
* @en
* The singleton of the Input class, this singleton manages all events of input. include: touch, mouse, accelerometer, gamepad, handle, hmd and keyboard.
@@ -33772,29 +33721,8 @@
*/
off<K extends keyof __private._cocos_input_input__InputEventMap>(eventType: K, callback?: __private._cocos_input_input__InputEventMap[K], target?: any): void;
/**
* @en
- * Get touch object by touch ID.
- * @zh
- * 通过 touch ID 获取 touch对象。
- */
- getTouch(touchID: number): Readonly<Touch> | undefined;
- /**
- * @en
- * Get all the current touches objects as array.
- * @zh
- * 获取当前 所有touch对象 的数组。
- */
- getAllTouches(): Touch[];
- /**
- * @en
- * Get the number of touches.
- * @zh
- * 获取当前 touch 对象的数量。
- */
- getTouchCount(): number;
- /**
- * @en
* Sets whether to enable the accelerometer event listener or not.
*
* @zh
* 是否启用加速度计事件。
@@ -46791,15 +46719,8 @@
protected onEnable(): void;
protected onDisable(): void;
protected start(): void;
protected onDestroy(): void;
- /**
- * @en
- * If the physics engine is box2d, need to call this function to apply current changes to joint, this will regenerate inner box2d joint.
- * @zh
- * 如果物理引擎是 box2d, 需要调用此函数来应用当前 joint 中的修改。
- */
- apply(): void;
}
export class DistanceJoint2D extends Joint2D {
TYPE: EJoint2DType;
/**
@@ -47578,8 +47499,12 @@
* @zh
* 触发`trigger`和`collision`事件。
*/
emitEvents(): void;
+ get debugDrawFlags(): number;
+ set debugDrawFlags(v: number);
+ get debugDrawConstraintSize(): number;
+ set debugDrawConstraintSize(v: number);
/**
* @en
* Collision detect all collider, and record all the detected results, through PhysicsSystem.Instance.RaycastResults access to the results.
* @zh
@@ -49757,8 +49682,38 @@
* 默认分组。
*/
DEFAULT = 1
}
+ export enum EPhysicsDrawFlags {
+ /**
+ * @en
+ * Draw nothing.
+ * @zh
+ * 不绘制。
+ */
+ None = 0,
+ /**
+ * @en
+ * Draw wireframe
+ * @zh
+ * 绘制线框。
+ */
+ Wireframe = 1,
+ /**
+ * @en
+ * Draw Constraint.
+ * @zh
+ * 绘制约束
+ */
+ Constraint = 2,
+ /**
+ * @en
+ * Draw AABB.
+ * @zh
+ * 绘制包围盒。
+ */
+ Aabb = 4
+ }
export { ITriggerEvent, TriggerEventType, TriggerCallback, IContactEquation, ICollisionEvent, CollisionEventType, CollisionCallback, CharacterTriggerEventType, CharacterCollisionEventType, CharacterControllerContact };
}
export namespace primitives {
/**
@@ -57624,8 +57579,9 @@
export import CapsuleCharacterController = physics.CapsuleCharacterController;
export import ERigidBodyType = physics.ERigidBodyType;
export import EAxisDirection = physics.EAxisDirection;
export import EColliderType = physics.EColliderType;
+ export import EPhysicsDrawFlags = physics.EPhysicsDrawFlags;
export namespace __private {
/**
* Engine classes with this kind of signature are integrated with editor extendability.
* @internal
@@ -66309,9 +66265,8 @@
}
export const _cocos_physics_2d_framework_components_colliders_collider_2d__Collider2D_base: new (...args: any[]) => Component & _cocos_core_event_eventify__IEventified;
export interface _cocos_physics_2d_spec_i_physics_joint__IJoint2D extends _cocos_physics_spec_i_lifecycle__ILifecycle {
readonly impl: any;
- apply(): void;
initialize(v: Joint2D): void;
}
export interface _cocos_physics_spec_i_physics_world__IRaycastOptions {
mask: number;
@@ -66320,8 +66275,10 @@
maxDistance: number;
}
export interface _cocos_physics_spec_i_physics_world__IPhysicsWorld {
readonly impl: any;
+ debugDrawFlags: physics.EPhysicsDrawFlags;
+ debugDrawConstraintSize: number;
setGravity: (v: math.IVec3Like) => void;
setAllowSleep: (v: boolean) => void;
setDefaultMaterial: (v: physics.PhysicsMaterial) => void;
step(fixedTimeStep: number, timeSinceLastCalled?: number, maxSubSteps?: number): void;
|
SantyWang
reviewed
Sep 25, 2023
… into v3.8.2_physics_debug_draw
在这个PR里实现 #16325 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: #https://github.com/cocos/3d-tasks/issues/17606
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: